package com.ruoyi.project.poem.poem.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.poem.poem.mapper.PoemMapper;
import com.ruoyi.project.poem.poem.domain.Poem;
import com.ruoyi.project.poem.poem.service.IPoemService;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;

/**
 * 古诗词Service业务层处理
 * 
 * @author shixiangwen
 * @date 2020-03-30
 */
@Service
@DataSource(DataSourceType.POEM)
public class PoemServiceImpl implements IPoemService {
	@Autowired
	private PoemMapper poemMapper;

	/**
	 * 查询古诗词
	 * 
	 * @param id 古诗词ID
	 * @return 古诗词
	 */
	@Override
	public Poem selectPoemById(Long id) {
		return poemMapper.selectPoemById(id);
	}

	/**
	 * 查询古诗词列表
	 * 
	 * @param poem 古诗词
	 * @return 古诗词
	 */
	@Override
	public List<Poem> selectPoemList(Poem poem) {
		return poemMapper.selectPoemList(poem);
	}

	/**
	 * 新增古诗词
	 * 
	 * @param poem 古诗词
	 * @return 结果
	 */
	@Override
	public int insertPoem(Poem poem) {
		return poemMapper.insertPoem(poem);
	}

	/**
	 * 修改古诗词
	 * 
	 * @param poem 古诗词
	 * @return 结果
	 */
	@Override
	public int updatePoem(Poem poem) {
		return poemMapper.updatePoem(poem);
	}

	/**
	 * 删除古诗词对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deletePoemByIds(String ids) {
		return poemMapper.deletePoemByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除古诗词信息
	 * 
	 * @param id 古诗词ID
	 * @return 结果
	 */
	@Override
	public int deletePoemById(Long id) {
		return poemMapper.deletePoemById(id);
	}
}
